package com.iris.live.services.data.repositories;

import com.iris.live.services.data.models.Lsh精品信息Model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by sxy on 2016/7/11
 */
@Transactional
public interface Lsh精品信息Repository extends JpaRepository<Lsh精品信息Model, Integer>, JpaSpecificationExecutor<Lsh精品信息Model> {

    @Modifying
    @Query("update Lsh精品信息Model u set u.启用状态 = ?2 where u.精品编号 = ?1")
    int set启用状态By精品编号(int id, String status);

    @Query("select a from Lsh精品信息Model a where a.采购来源=?1 and a.产品编号=?2")
    List<Lsh精品信息Model> findBy产品编号And采购来源(String source, String productId);


    @Query("select a from Lsh精品信息Model a where a.精品编号=?1 ")
   Lsh精品信息Model   findBy精品编号productId(int productId);


}
